﻿<UserControl x:Class="ViewNewPMTWizard"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             xmlns:res="clr-namespace:OMANE.Modules.PMT.My.Resources" 
             xmlns:local="clr-namespace:OMANE.Modules.PMT"
             xmlns:SampleData="clr-namespace:OMANE.Modules.PMT.Expression.Blend.SampleData.SamplePagesDataSource" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             mc:Ignorable="d" d:DesignHeight="473">

    <!-- xmlns:res="clr-namespace:GlobalizedWizard.My.Resources"
  xmlns:local="clr-namespace:GlobalizedWizard" -->
    
    <UserControl.Resources>

    	<local:InverseBooleanConverter x:Key="InverseBooleanConverter"/>

        <!-- These four templates map a ViewModel to a View. -->
    	<SampleData:SamplePagesDataSource x:Key="SamplePagesDataSource" d:IsDataSource="True"/>
        
        <DataTemplate DataType="{x:Type local:ViewModelNewPMTWizardPageParamGen}">
            <local:ViewNewPMTWizardParamGen />
        </DataTemplate>

        <DataTemplate DataType="{x:Type local:ViewModelNewPMTWizardPageTblesFlux}">
            <local:ViewNewPMTWizardTblesFlux/>
        </DataTemplate>       

        <Style TargetType="{x:Type Button}">
            <Setter Property="Padding" Value="3.5,0" />
            <Setter Property="Margin" Value="3.5" />
            <Setter Property="MinWidth" Value="80" />
        </Style>

        <!-- Inherits from the above Button style -->
        <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}" x:Key="moveNextButtonStyle">
            <Setter Property="Content" Value="Suivant &gt;" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsOnLastPage}" Value="True">
                    <Setter Property="Content" Value="Terminer" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <!-- HEADERED CONTENT CONTROL STYLE -->
        <Style TargetType="{x:Type HeaderedContentControl}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
                        <StackPanel Margin="2,0">
                            <Grid Margin="1,1,1,12" RenderTransformOrigin="0.5,0.5">
                                <Grid.Effect>
                                    <DropShadowEffect Opacity="0.1" />
                                </Grid.Effect>
                                <Grid.RenderTransform>
                                    <RotateTransform Angle="-3" />
                                </Grid.RenderTransform>
                                <Rectangle Height="3" Margin="10,0" Opacity="0.6"
										   RadiusX="8" RadiusY="8" VerticalAlignment="Bottom">
                                	<Rectangle.Fill>
                                		<SolidColorBrush>
                                			<SolidColorBrush.Color>
                                				<Color A="255" R="88" G="29" B="116" />
                                			</SolidColorBrush.Color>
                                		</SolidColorBrush>
                                	</Rectangle.Fill>
                                </Rectangle>
                            	<ContentPresenter ContentSource="Header"
                            		TextBlock.FontSize="22"
                            		TextBlock.FontWeight="DemiBold"
                            		HorizontalAlignment="Center"
                            		VerticalAlignment="Center"/>
                            </Grid>
                            <Grid>
                                <Rectangle Fill="{TemplateBinding Background}" />
                                <ContentPresenter ContentSource="Content" />
                            </Grid>
                        </StackPanel>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- WIZARD STEP TEMPLATE -->
        <DataTemplate x:Key="wizardStepTemplate">
            <Border x:Name="bdOuter" BorderBrush="Black" BorderThickness="0,0,1,1"
					CornerRadius="12" Margin="1,1,1,12" Opacity="0.25" 
					SnapsToDevicePixels="True">
                <Border x:Name="bdInner" Background="#FFFEFEFE" BorderThickness="2,2,1,1"
						CornerRadius="12" Padding="2" SnapsToDevicePixels="True">
                	<Border.BorderBrush>
                		<SolidColorBrush>
                			<SolidColorBrush.Color>
<!-- Définition des couleurs du thème -->
                				<Color A="255" R="88" G="29" B="116" />
                			</SolidColorBrush.Color>
                		</SolidColorBrush>
                	</Border.BorderBrush>
                    <TextBlock x:Name="txt" Margin="4,0,0,0" 
							   Text="{Binding DisplayName}"/>
                </Border>
            </Border>

            <DataTemplate.Triggers>
                <DataTrigger Binding="{Binding IsCurrentPage}" Value="True">
                    <Setter TargetName="txt" Property="FontWeight" Value="Bold"/>
                    <Setter TargetName="bdInner" Property="Background" Value="BurlyWood"/>
                    <Setter TargetName="bdOuter" Property="Opacity" Value="1"/>
                </DataTrigger>
            </DataTemplate.Triggers>
        </DataTemplate>
    </UserControl.Resources>
	<d:UserControl.DataContext>
		<local:ViewModelNewPMTWizard/>
	</d:UserControl.DataContext>
	

    <Grid Background="#11000000" Margin="1">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="200" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>

        <!-- WIZARD STEP LISTING -->
        <HeaderedContentControl Header="CREATION PMT">
        	<HeaderedContentControl.Foreground>
        		<SolidColorBrush>
        			<SolidColorBrush.Color>
        				<Color A="255" R="88" G="29" B="116" />
        			</SolidColorBrush.Color>
        		</SolidColorBrush>
        	</HeaderedContentControl.Foreground>
            <ItemsControl ItemsSource="{Binding Pages, Mode=OneWay}" ItemTemplate="{StaticResource wizardStepTemplate}"/>
        </HeaderedContentControl>

        <!-- CURRENT PAGE AREA -->
        <Border Background="White" Grid.Column="1" Grid.Row="0">
        	<Border.Resources>
        		<Style TargetType="{x:Type Button}">
            		<Setter Property="Padding" Value="3.5,0" />
            		<Setter Property="Margin" Value="3.5" />
            		<Setter Property="MinWidth" Value="0" />
        		</Style>
			</Border.Resources>
            <HeaderedContentControl Content="{Binding CurrentPage}" Header="{Binding CurrentPage.DisplayName}"/>
        </Border>

        <Border Grid.Column="0" Grid.Row="1" Background="LightGray" Grid.ColumnSpan="2">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <!-- NAVIGATION BUTTONS -->
                <Grid Grid.Column="2" Grid.IsSharedSizeScope="True" HorizontalAlignment="Right">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition SharedSizeGroup="Buttons" />
                        <ColumnDefinition SharedSizeGroup="Buttons" />
                        <ColumnDefinition Width="11" />
                        <ColumnDefinition SharedSizeGroup="Buttons" />
                    </Grid.ColumnDefinitions>
                    <Button Grid.Column="0" Command="{Binding MovePreviousCommand}" 
                            Content="&lt; Back" IsEnabled="{Binding IsOnFirstPage, Converter={StaticResource InverseBooleanConverter}, Mode=OneWay}"/>
                    <Button Grid.Column="1" Command="{Binding MoveNextCommand}" 
                            Style="{StaticResource moveNextButtonStyle}" IsEnabled="{Binding CurrentPage.IsValid, Mode=OneWay}"/>
                    <Button Grid.Column="3" Command="{Binding CancelCommand}" 
                            Content="Cancel"/>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</UserControl>